<template>
  <f7-list media-list>
    <slot v-for="item in dataList" name="listItem" :data="item"></slot>
  </f7-list>
</template>

<script type="text/ecmascript-6">
  export default {
    props: {
      targetUrl: {
        type: String,
        default: null
      },
      isAvatar: {
        type: Boolean,
        default: false
      },
      defaultAvatar: {
        type: String,
        default: `/static/images/default_user.png`
      }
    },
    data() {
      return {
        pager: {
          totalCount: 0,
          pageSizes: 20,
          currentPage: 1,
          limit: 10,
          start: 0
        },
        dataList: []
      }
    },
    mounted() {
      this.getData()
    },
    methods: {
      getData() {
        let _data = {
          jsonStr: '',
          page: this.pager.currentPage,
          start: this.pager.start,
          limit: this.pager.limit,
          sort: null,
          otherStr: ''
        }
        this.$http.request({
          method: 'get',
          url: this.targetUrl,
          params: _data
        }).then(res => {
          this.dataList = res.data.data
        })
      }
    }
  }
</script>

